"""syl URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include

from syl import settings

urlpatterns = [
    path('admin/', admin.site.urls),
    path('user/', include('user.urls')),  # 导包路径,  sys.path  必须有个  apps目录 作为查找包的目录
    path('', include('demo_app.urls')),  # 导包路径,  sys.path  必须有个  apps目录 作为查找包的目录
    path('', include('oauth.urls')),  # 导包路径,  sys.path  必须有个  apps目录 作为查找包的目录
    path('', include('course.urls')),  # 导包路径,  sys.path  必须有个  apps目录 作为查找包的目录
    path('', include('paths.urls')),  # 导包路径,  sys.path  必须有个  apps目录 作为查找包的目录
    path('', include('payment.urls')),  # 导包路径,  sys.path  必须有个  apps目录 作为查找包的目录
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# 生成restful路由对象
from rest_framework.routers import DefaultRouter

router = DefaultRouter()

# 增加课程子应用视图路由
from course.views import *

router.register('tag', TagModelViewSet)
router.register('course', CourseModelViewSet)
router.register('chapter', ChapterModelViewSet)
router.register('section', SectionModelViewSet)
router.register('follow', FollowModelViewSet)
router.register('course_comment', CourseCommentModelViewSet)

# 增加路径子应用视图路由
from paths.views import *

router.register('paths', PathsModelViewSet)
router.register('stage', StageModelViewSet)
router.register('path_comment', PathCommentModelViewSet)

urlpatterns += router.urls
